#ifndef _RELAY_H_
#define _RELAY_H_

#define PORT_RELAYS      	1

#define RELAY_AGUA      	(1<<25)
#define RELAY_AQUECIMENTO      	(1<<6)



#define PORT_RELAYS_INV    	0			//Controle do inversor
#define RELAY_HABILITA_INV	(1<<17)		//Habilita o inversor
#define RELAY_SENTIDO_INV	(1<<18)		//Habilita o sentido so inversor
#define RELAYS_INV			(RELAY_HABILITA_INV|RELAY_SENTIDO_INV)

#define PORT_MOTORES		2
#define RELAY_MOTOR_BLOCO       (1<<8)
#define RELAY_MOTOR_BRACO       (1<<7)
#define RELAYS_MOTORES		((RELAY_MOTOR_BLOCO)|(RELAY_MOTOR_BRACO))

#define PORT_PONTEH		0
#define RELAY_AVANCO1	(1<<21)
#define RELAY_AVANCO2	(1<<22)

#define RELAY_RECUO1	(1<<23)
#define RELAY_RECUO2	(1<<24)
#define RELAYS_PONTEH	((RELAY_AVANCO1)|(RELAY_AVANCO2)|(RELAY_RECUO1)|(RELAY_RECUO2))

//definicoes para controle das valvulas do pneumatico
#define PORT_AVANCOBRACO        PORT_MOTORES
#define RELAY_AVANCOBRACO       RELAY_AQUECIMENTO

#define PORT_RECUOBRACO         PORT_MOTORES
#define RELAY_RECUOBRACO        RELAY_MOTOR_BRACO

void relay_init (void);
void relay_active  (uint8_t Port,uint32_t relay);
void relay_deactive(uint8_t Port,uint32_t relay);
void AvancoMotorMola(void);
void RecuoMotorMola(void);
void DesativaPonteH(void);
void AvancoBraco(void);
void RecuoBraco(void);
#endif
